package com.beiding.t;

import com.beiding.jsonanalyzer.analyze.ResourceUtils;

import java.io.File;

/**
 * @author 丁常磊
 * @date 2022/4/16 11:51
 */

public class 查找文本字符串 {

    private static File dir = new File("C:\\Users\\lenovo\\Desktop\\新建文件夹 (6)");
    private static String txt = "com.efuture.ocm.mdm.getConsume";

    public static void main(String[] args) {

        deep(dir);
    }

    private static void deep(File file) {
        if (file.isDirectory()) {
            File[] listFiles = file.listFiles();
            if (listFiles != null) {
                for (File listFile : listFiles) {
                    deep(listFile);
                }
            }
        } else if (file.isFile()) {

                String read = ResourceUtils.read(file);
                if (read.contains(txt)) {
                    System.out.println(file);
                }
        }
    }

}
